<template>
    <div class="goodsdesc-container">
        <h3 class="title">{{info.title}}</h3>
        <hr>
        <div class="content" v-html="info.content"></div>
    </div>
</template>
 
<script>
export default {
    data() {
        return {
            info:{}//商品的描述信息
        }
    },
    props:["id"],
    activated() {
        this.getGoodsDesc();
    },
    methods: {
        // async getGoodsDesc(){
        //     const {data}=await this.$http.get("/api/goods/getdesc/"+this.id);
        //     if(data.status===0)return (this.info=data.message[0]);
        // }
        getGoodsDesc(){
            this.$http.get("/getDescInfo", { 
                params:{
                    id: this.id
                }
            }).then((res) => {
                if(res.data.errcode === 200){
                    let data = res.data.message[0]; 
                    this.info = data;
                }
            });
        }
    },
}
</script>

<style lang="scss">
// 在外面加了一个div，可以解决因为去掉scoped带来的影响
.goodsdesc-container{
    .title{
    font-size: 16px;
    margin: 10px 0; //上下 左右
    color: blue;
    text-align: center;
    }
    .content{
        img{
        width:100%
     }   
    }  
}

</style>